/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package crub_demo;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Hnmtuan
 */
@Entity
@Table(name = "loaiphim", catalog = "bookingplacecinema", schema = "")
@NamedQueries({
    @NamedQuery(name = "Loaiphim.findAll", query = "SELECT l FROM Loaiphim l"),
    @NamedQuery(name = "Loaiphim.findByIdLoaiPhim", query = "SELECT l FROM Loaiphim l WHERE l.idLoaiPhim = :idLoaiPhim"),
    @NamedQuery(name = "Loaiphim.findByCodeLoaiPhim", query = "SELECT l FROM Loaiphim l WHERE l.codeLoaiPhim = :codeLoaiPhim"),
    @NamedQuery(name = "Loaiphim.findByTenLoaiPhim", query = "SELECT l FROM Loaiphim l WHERE l.tenLoaiPhim = :tenLoaiPhim"),
    @NamedQuery(name = "Loaiphim.findByTrangThai", query = "SELECT l FROM Loaiphim l WHERE l.trangThai = :trangThai")})
public class Loaiphim implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "IdLoaiPhim")
    private Integer idLoaiPhim;
    @Column(name = "CodeLoaiPhim")
    private String codeLoaiPhim;
    @Column(name = "TenLoaiPhim")
    private String tenLoaiPhim;
    @Lob
    @Column(name = "MoTa")
    private String moTa;
    @Column(name = "TrangThai")
    private Integer trangThai;

    public Loaiphim() {
    }

    public Loaiphim(Integer idLoaiPhim) {
        this.idLoaiPhim = idLoaiPhim;
    }

    public Integer getIdLoaiPhim() {
        return idLoaiPhim;
    }

    public void setIdLoaiPhim(Integer idLoaiPhim) {
        Integer oldIdLoaiPhim = this.idLoaiPhim;
        this.idLoaiPhim = idLoaiPhim;
        changeSupport.firePropertyChange("idLoaiPhim", oldIdLoaiPhim, idLoaiPhim);
    }

    public String getCodeLoaiPhim() {
        return codeLoaiPhim;
    }

    public void setCodeLoaiPhim(String codeLoaiPhim) {
        String oldCodeLoaiPhim = this.codeLoaiPhim;
        this.codeLoaiPhim = codeLoaiPhim;
        changeSupport.firePropertyChange("codeLoaiPhim", oldCodeLoaiPhim, codeLoaiPhim);
    }

    public String getTenLoaiPhim() {
        return tenLoaiPhim;
    }

    public void setTenLoaiPhim(String tenLoaiPhim) {
        String oldTenLoaiPhim = this.tenLoaiPhim;
        this.tenLoaiPhim = tenLoaiPhim;
        changeSupport.firePropertyChange("tenLoaiPhim", oldTenLoaiPhim, tenLoaiPhim);
    }

    public String getMoTa() {
        return moTa;
    }

    public void setMoTa(String moTa) {
        String oldMoTa = this.moTa;
        this.moTa = moTa;
        changeSupport.firePropertyChange("moTa", oldMoTa, moTa);
    }

    public Integer getTrangThai() {
        return trangThai;
    }

    public void setTrangThai(Integer trangThai) {
        Integer oldTrangThai = this.trangThai;
        this.trangThai = trangThai;
        changeSupport.firePropertyChange("trangThai", oldTrangThai, trangThai);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idLoaiPhim != null ? idLoaiPhim.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Loaiphim)) {
            return false;
        }
        Loaiphim other = (Loaiphim) object;
        if ((this.idLoaiPhim == null && other.idLoaiPhim != null) || (this.idLoaiPhim != null && !this.idLoaiPhim.equals(other.idLoaiPhim))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "crub_demo.Loaiphim[idLoaiPhim=" + idLoaiPhim + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
